import { createSlice } from "@reduxjs/toolkit";
//创建 zanSlice 对象
let zanSlice = createSlice({
  name: 'zan',
  initialState: 100,
  // {type: 'incre'}   {type: 'incre'}
  reducers: {
    incre: (state, action) => {
      return state + action.payload;
    },
    decre: (state, action) => {
      return state - action.payload;
    }
  }
});

//获取同步的 action creator
export let {incre, decre} = zanSlice.actions;

//获取 reducer 函数
let zanReducer = zanSlice.reducer;

//暴露
export default zanReducer;
